Page({
  /*页面的初始数据*/
  data: {
    dotsFlag:true,
    msg:"欢迎你能够来到我的世界￣□￣",
    bannerList:[
      {imgSrc:"../../images/banner03.webp"},
      {imgSrc:"../../images/banner02.webp"},
      {imgSrc:"../../images/banner01.webp"}],
      grids:[
        {imgSrc:"/images/jgch.jpg",title:"你这个坚果扫货！"},
        {imgSrc:"/images/mjgg.jpg",title:"你这个蜜饯果干！"},
        {imgSrc:"/images/phsp.jpg",title:"你这个膨化食品！"},
        {imgSrc:"/images/rgss.jpg",title:"你这个肉干熟食！"},
        {imgSrc:"/images/tgqkl.jpg",title:"你这个糖果巧克力！"},
        {imgSrc:"/images/xxls.jpg",title:"你这个休闲零食！"},
        {imgSrc:"/images/yyls.jpg",title:"你这个营养零食！"},
        {imgSrc:"/images/zhlzh.jpg",title:"你这个中华老字号！"},],
    array:[{
      message:'foo',
    },{
      message:'bar',
    }]
  },
  getCode(e){
    //存储当前点击的类别编码，并跳转到demo
    let code=e.currentTarget.dataset.code;
    // console.log(code);
    wx.setStorageSync('cateCode',code);
    //跳转到demo
    wx.switchTab({
      url: '/pages/demo/demo',
    });
  },
  chamgeDotsflag(){
    this.setData({
      dotsFlag:!this.data.dotsFlag,
      msg:"welcome"
    });
    },
  /*生命周期函数--监听页面加载*/
  onLoad(options) {
    console.log("onload");
    var that=this
    //这里写服务器数据请求过程
    wx.request({
      url: 'http://kjxycode.zisu.edu.cn/InterfaceCommonForGoods/GetGoodsSalePromotionList',
      data: {token:"kjxy_Interface_2025"},
      // dataType: dataType,
      // enableCache: true,
      // enableChunked: true,
      // enableHttp2: true,
      // enableHttpDNS: true,
      // enableQuic: true,
      // forceCellularNetwork: true,
      // header: header,
      // httpDNSServiceId: 'httpDNSServiceId',
      method: "post",
      // responseType: responseType,
      // timeout: 0,
      success:function(e){
        let result=e.data.goodsSalePromotionList;
        console.log(result),
        wx.setStorageSync('cateList', result);
        // that.setData({bannerList:[]});
        that.setData({bannerList:result});
      }
      // fail: (err) => {},
      // complete: (res) => {},
    })
  wx.request({
  url:'http://kjxycode.zisu.edu.cn/InterfaceCommonForGoods/GetGoodsCateList',
  data: {token:"kjxy_Interface_2025"},
  method: "post",
  success:function(e){
    let result=e.data.cateList;
    // console.log(result)
    wx.setStorageSync('cateList', result)
    that.setData({grids:result});
  }
})
},
  /* 生命周期函数--监听页面初次渲染完成*/
  onReady() {
    console.log("onReady");
  },
  /* 生命周期函数--监听页面显示*/
  onShow() {
    console.log("onShow");
  },
  /*生命周期函数--监听页面隐藏*/
  onHide() {
    console.log("onHide");
  },
  /*生命周期函数--监听页面卸载*/
  onUnload() {
    console.log("onUnload");
  },
  /*页面相关事件处理函数--监听用户下拉动作*/
  onPullDownRefresh() {
  },
  /*页面上拉触底事件的处理函数*/
  onReachBottom() {
  },
  /*用户点击右上角分享*/
  onShareAppMessage() {
  }
});